<?php
$ex_data = isset($_['ex_data']) ? $_['ex_data'] : null;
$interviewers = isset($_['interviewers']) ? $_['interviewers'] : null;
$tpl_list = isset($_['tpl_list']) ? $_['tpl_list'] : null;
$interview_list = isset($_['interview_list'])? $_['interview_list']:null;
$userQuota = PCompanyHelper::getUserQuota();
?>
<div class="modal-body medium">
   <?php if($ex_data->type == 1): ?>
   <div class="autosteparrow medium">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
            <td width="20"><div class="autoarrow autoleft_gg autoleft_yy"></div></td>
            <td><div class="autoword_gg autoword_yy">&nbsp;指定应聘者&nbsp;</div></td>
            <td width="27"><div class="autoarrow automid_gg automid_yg automid_yy"></div></td>
            <td><div class="autoword_gg autoword_yy">填写面试信息</div></td>
            <td width="27"><div class="autoarrow automid_gg automid_yg"></div></td>
            <td><div class="autoword_gg">&nbsp;&nbsp;&nbsp;&nbsp;完成&nbsp;&nbsp;&nbsp;&nbsp;</div></td>
            <td width="19"><div class="autoarrow autoright_gg"></div></td>
         </tr>
      </table>
   </div>
   <?php endif; ?>
   
   <div class="form-horizontal">
      <?php if(isset($_['resultid']) && $_['resultid'] == PCalendarHelper::INTERVIEW_RESULT_CANCEL && $_['totalfeedbacks'] > 0) {?><div style="text-align:center;"><span class='error'><b style="font-size: 14px;">重新安排面试将会清空此轮已有的面试反馈</b></span></div><?php }?>
      <div class="control-group" style="margin-bottom:4px;">   
         <label class="control-label" for="jobtitle">职<i class="jiange"></i>位：</label>
         <div class="controls pull-left" style="margin-left:4px;">
            <span>
               <a href="<?php echo isset($ex_data->jobid) ? OC_Helper::linkToRoute("jobpos_setup", array('id'=>$ex_data->jobid, 'job_title'=>isset($ex_data->job_title) ? $ex_data->job_title : '')) : 'javascript:;'?>" id="jobtitle" target="_blank">
                  <?php echo isset($ex_data->job_title) ? strmaxwordlen($ex_data->job_title,10) : '';?>
               </a>
            </span>
         </div>

         <label class="control-label" for="jobseekername">姓<i class="jiange"></i>名：</label>
         <div class="controls pull-left" style="margin-left:4px; margin-right:30px;">
            <span>
               <a href="<?php echo isset($ex_data->jobseekerid) ? OCP\Util::linkToRoute('resume_view', array('id' => $ex_data->jobseekerid, 'name' => $ex_data->jobseekername)) : 'javascript:;'?>" id="jobseekername" target="_blank">
                  <?php echo isset($ex_data->jobseekername) ? strmaxwordlen($ex_data->jobseekername,5) : '';?>
               </a>
            </span>
         </div>
      </div>
      <div class="control-group">
         <label class="control-label" for="from"><em class="redstar">* </em>开始时间：</label>
         <div class="controls">
            <input type="text" class="input-medium startdate" value="<?=$_['startdate']?>" name="from" id="from">
            &nbsp;
            <input type="text" class="input-small" value="<?=$_['starttime']?>" name="fromtime" id="fromtime">
            <label class="checkbox inline medium" style="color:#666666; margin-left:6px; padding-top:0px;">
               <input type="checkbox" name="isphone" value="1" <?php echo (isset($ex_data->is_phone) && $ex_data->is_phone > 0) ? 'checked' : '';?>>电话面试
            </label>
         </div>
      </div>
      
      <div class="" id="notify_form" data-tpltype="notify">
         <div class="lagouy_titlebox clearfix">
            <div class="mod_action_title pull-left"><b>此信息发给应聘者</b></div>
            <div class="mod_action pull-right">
               <a href="javascript:;" id="addtpl">存为模板</a>
               <em class="lineem">|</em>
               <!-- add dropdown class to activate arrow -->
               <div id="invs_one" class="inviteselectmenubox special <?php echo count($tpl_list) > 0 ? 'dropdown' : ''?>">
                  <a id="choose_tpl" href="javascript:;" class="dropdown-toggle" data-toggle="<?php echo count($tpl_list) > 0 ? 'dropdown' : ''?>" data-target="#"><b>选择模板</b> <i class="blue_triangle"></i></a>
                  <div id="tpl_list" class="dropdown-menu" style="left:auto; right:0px;">
                     <?php if ( count($tpl_list) > 0 ) {
                        foreach ($tpl_list as $key => $value) {
                           ?>
                           <a id="<?php echo $value['id'];?>" href="javascript:;">
                              <span class="apply" style="display:inline;"><?php echo $value['tpl_name'];?></span>
                              <i class="delete"></i>
                           </a>
                           <?php
                        }
                     }?>
                  </div>
               </div>
            </div>
            <div id="purposlistbox" class="purposlistbox pull-left clearfix" style="display:none;">
               <i></i>
               <input id="tplname" name="tplname" type="text" placeholder="模板名称" class="pull-left" />
               <button id="savetpl" class="btn pull-left" type="button">保存</button>
               <span class="medium" style="padding:2px 0 0 20px;">最多可保存3个模板</span>
               <div id="tpl_error" class="enough_tipword" style="display:none; margin-top:3px;"></div>
            </div>
         </div>

         <div class="control-group">
            <label class="control-label" for="from"><em class="redstar">* </em>面试地点：</label>
            <div class="controls">
               <input type="text" id="address" name="address" style="width:400px;/" value="<?php echo isset($ex_data->address) ? $ex_data->address : '';?>">
            </div>
         </div>

         <div class="control-group">
            <label class="control-label" for=""><em class="redstar">* </em>联系电话：</label>
            <div class="controls pull-left" style="margin-left:4px; margin-right:5px;">
               <input type="text" id="contact_phone" name="contact_phone" class="input-medium" value="<?php echo isset($ex_data->contact_phone) ? $ex_data->contact_phone : '';?>"/>
            </div>
         
            <label class="control-label" for="">联系人：</label>
            <div class="controls pull-left" style="margin-left:4px;">
               <input type="text" id="contact" maxlength="20" name="contact" class="input-medium" value="<?php echo isset($ex_data->contact) ? $ex_data->contact : '';?>"/>
            </div>
         </div>

         <div class="control-group">
            <label class="control-label" for="notify_text">面试通知：</label>
            <div class="controls">
               <textarea id="notify_text" name="notify_text" placeholder="面试路线" style="height:40px;"><?php echo isset($ex_data->notify_text) ? $ex_data->notify_text : '';?></textarea>
               <div class="mod_action clearfix">
                  <div class="interv_uplbox pull-left" id="calendar_att_div">
                     <a href="javascript:;" >上传面试附件</a>
                     <em class="lineem">|</em>
                     <div class="inviteselectmenubox special <?php echo count($interview_list) > 0 ? 'dropdown' : ''?>">
                        <a id="invs_two" class="dropdown-toggle" data-target="#"  data-toggle="<?php echo count($interview_list) > 0 ? 'dropdown' : ''?>" href="javascript:;">
                           <b>选择附件</b> <i class="blue_triangle"></i>
                        </a>
                        <div class="dropdown-menu history_list" style="left:0px; right:auto;">
                        <?php if(count($interview_list) > 0){
                           foreach($interview_list as $list){?>
                        <a id="choosehistory" data="{'attachname':'<?=addslashes($list['file_name']) ?>','attachid':'<?=$list['id'] ?>' }" href="javascript:;" class="this<?=$list['id'] ?>"> <span style="display:inline;"><?=$list['file_name']?></span> <i data="{'attachid':'<?=$list['id'] ?>','attachname':'<?=$list['file_name'] ?>' }"  id="history_atachment" class="delete"></i></a>
                        <?php }}?>
                        </div>
                     </div>
                  </div>
                  
                   <table id="uploadTable" class="files" cellpadding="0" cellspacing="0" border="0" style="margin:auto;margin-left:0px;">
                       <tr class="file_upload_template" style="display:none;">
                       <td class="file_name"></td>
                       <td class="file_upload_progress"></td>
                       </tr>
                   </table>
               </div>

               <div class="errors" style="color:red;margin-top:8px; display:none;"></div>
               <div class="fileshowarea" id="fileshowarea" <?=((!isset($ex_data->attachment)|| !$ex_data->attachment)? ("style='display:none;'"):"")?>>
               <?php 
                  if(!empty($ex_data->attachment))
                     echo "<span class='".$ex_data->attachment."'<em>".$ex_data->file_name."</em> <a href='javascript:;' id='del_name' data={'attachid':'".$ex_data->attachment."'}>删除</a></br></span>";
               ?>
               </div>
            </div>
         </div>
      </div>

      <div class="lagouy_titlebox clearfix" style="margin-top:20px;">
         <div class="mod_action_title pull-left"><b>以下信息仅发给面试官</b></div>
      </div>
      <?php
         if (!empty($interviewers)) {
            $j = count($interviewers);
         } else {
            $j = 2;
         }
         $j = $j < 2 ? 2 :$j;
         ?>
         <div id="interviewer_list" count="<?php echo $j;?>">
         <?php
         for ($i=0; $i < $j; $i++) {
            ?>
            <div class="control-group">
               <label class="control-label" for=""><?php echo $i==0 ? "<em class='redstar'>* </em>" : "";?>面试官<?php echo $i+1;?>：</label>
               <div class="controls">
                  <input type="text" name="interviewer[]" value="<?php echo isset($interviewers[$i]->email) ? $interviewers[$i]->email : '';?>" placeholder="面试官邮箱地址" class="iptsolong">
                  <input type="text" class="iptsomin eventtime starttime" value="<?php echo isset($interviewers[$i]->startdate) ? JHtml::_('date',$interviewers[$i]->startdate, 'H:i') : (($i===0)?$_['starttime']:'')?>" name="starttime[]">
                  <span>至</span>
                  <input type="text" class="iptsomin eventtime endtime" value = "<?php echo isset($interviewers[$i]->enddate) ? JHtml::_('date',$interviewers[$i]->enddate, 'H:i') :''?>" name="endtime[]"/>
               </div>
            </div>
            <?php
         }?>
         </div>
      
      <div class="control-group">
         <div class="controls">
            <a href="javascript:;" class="addinterviewer" id="addinterviewer">增加面试官 <i></i></a>
         </div>
      </div>
      <div class="control-group">
         <label class="control-label" for="summary">备<i class="jiange"></i>注：</label>
         <div class="controls">
            <textarea name="summary" placeholder="面试建议" style="height:21px;"><?php echo isset($ex_data->summary) ? $ex_data->summary : '';?></textarea>
         </div>
      </div>
      
      
      <div class="sendsety_cbg" style="margin-bottom:4px;">
         <div class="control-group">
            <label for="" class="control-label"><em class="redstar">* </em>发送设置：</label>
            <div style="margin-left:78px;" class="controls">
               
               <?php if(empty($ex_data->validemail)) {?>
               <label class="checkbox medium gray inline" <?php echo ($userQuota['sms_left'] > 0 ) ? 'title="简历缺少Email信息"' : ''; ?>>
                  <input type="checkbox" name="sendemail" id="sendemail" disabled="disabled" value="email">Email
               </label>
               <?php } else { ?>
               <label class="checkbox medium inline">
                  <input type="checkbox" name="sendemail" id="sendemail" disabled="disabled" checked=1 value="email">Email
               </label>
               <?php } ?>
               <?php if($userQuota['sms_left'] > 0 ) {?>
               <label class="checkbox medium inline">
                  <?php if(!empty($userQuota['email_sms_settings']['sms_offlineinterview_0d'])) { ?>
                  <input type="checkbox" id="sendsms" name="sendsms" checked = 1 value="sms">手机短信(<em>剩余<?=$userQuota['sms_left']?>条</em>)
                  <?php } else { ?>
                  <input type="checkbox" id="sendsms" name="sendsms" value="">手机短信(<em>剩余<?=$userQuota['sms_left']?>条</em>)
                  <?php } ?>
               </label>
               <?php } else {?>
               <label class="checkbox medium gray inline">
                  <input type="checkbox" id="sendsms" name="sendsms" disabled="disabled" value="sms">手机短信(剩余0条) <a href="<?=OC_Helper::linkToRoute('company_quota'); ?>" target="_blank" class="buymessage">立即购买</a>
               </label>
               <?php }?>
            </div>
         </div>
      </div>
      

      <input name="requesttoken" value="<?=$_['requesttoken']?>" id="requesttoken" type="hidden">
      <input name="calendar" value="<?=isset($_['calendar_options'][0]['id'])?$_['calendar_options'][0]['id']:''?>" type="hidden">
      <input name="round" value="<?=isset($ex_data->round)?$ex_data->round:''?>" type="hidden">
      <input name="categories" value="" type="hidden">
      <input name="accessclass" value="PUBLIC" type="hidden">
      <input name="objecttype" value="<?php echo isset($_['objecttype']) ? $_['objecttype'] : 'VEVENT';?>" type="hidden">
      <input name="jobid" id="jobid" value="<?php echo isset($ex_data->jobid) ? $ex_data->jobid : 0;?>" type="hidden">
      <input name="jobseekerid" value="<?php echo isset($ex_data->jobseekerid) ? $ex_data->jobseekerid : 0;?>" type="hidden">
      <input name="jobtitle" value="<?php echo isset($ex_data->job_title) ? $ex_data->job_title : '';?>" type="hidden">
      <input name="jobseekername" value="<?php echo isset($ex_data->jobseekername) ? $ex_data->jobseekername : '';?>" type="hidden">
      <input name="attachment"  id="attachment" value="<?php echo isset($ex_data->attachment) ? $ex_data->attachment : ''?>" type="hidden">
   </div>
</div>
